﻿using ApiDemo.Modals;
using Microsoft.AspNetCore.Mvc;
using QQZiCore.Mvc.Controllers;
using QQZiFramework;
using QQZiFramework.MQ;

namespace ApiDemo.Controllers
{
    public class RedisController : BaseController
    {
        /// <summary>
        /// 写入redis并读取返回
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public JsonApiData SetGet(string keyName,string msg)
        {
            CreateDBContext().GetRedisDatabase().SetRedisItem(keyName, msg);
            var val = CreateDBContext().GetRedisDatabase().GetRedisItem<string>(keyName);
            return new JsonApiData() { data =val};
        }
    }
}
